import App from './App'


// #ifndef VUE3
import Vue from 'vue'
import store from './store/index.js'


import './uni.promisify.adaptor'

Vue.config.productionTip = false
App.mpType = 'app'





import GlobalComponents from './components/index.vue'
const ComponentsObj = Vue.extend(GlobalComponents)


// h5所有页面挂上GlobalComponents组件
const initGlobalComponents = () => {

	//不兼容移动端
	const uniApp = app?.$el
	
	//在H5端为uni-app结点，在微信小程序中为null直接返回
	
	if (!uniApp) return
     
	// 全局组件挂载
	const vm = new ComponentsObj({
		store,
	}).$mount()

	uniApp?.appendChild(vm?.$el)
}

const app = new Vue({
	...App,
	store,
	// beforeCreate() {
	// 	Vue.prototype.$bus = this
	// 	Vue.prototype.$tip = tip
	// 	Vue.prototype.$notice = notice
		
	// },
})

app.$mount()
initGlobalComponents()


// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'

export function createApp() {
	const app = createSSRApp(App)
	return {
		app,
	}
}
// #endif